package common.hua.com.mycontrolactivity;


import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.hua.common.BaseActivity;
import com.hua.common.commonview.RingControl;

import common.hua.com.myapplication.R;

/**
 *圆环控件测试界面
 * @author huaxiaolin_pc
 *
 */
public class RingControlActivity extends BaseActivity implements OnClickListener {

	private RingControl control = null;
	private Button start,reset,cancel = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.initViews();
		this.setPageTitle("圆环");
	}

	private void initViews() {
		setContentViewItem(R.layout.ringactivitylayout);
		this.control = (RingControl) this.findViewById(R.id.ring);
		this.control.setColors(new int[] { Color.parseColor("#ffccdd"),
				Color.parseColor("#aaaadd"), Color.parseColor("#00ffff"), Color.parseColor("#ff0044")  });
		this.control.setareaCounts(new float[] { 0.005f, 0.595f, 0.3f,0.1f });
		this.start = (Button) this.findViewById(R.id.start);
		this.start.setOnClickListener(this);
		this.reset = (Button) this.findViewById(R.id.reset);
		this.reset.setOnClickListener(this);
		this.cancel = (Button) this.findViewById(R.id.cancel);
		this.cancel.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.start:
				this.control.start();
				break;

			case R.id.cancel:
				this.control.cancel();
				break;
			case R.id.reset:
				this.control.reset();
				break;
		}

	}
}
